package com.qzsoft.zhjd.materiel.modules.materielsupplierdetailed.controller;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzsoft.jeemis.common.utils.Result;
import com.qzsoft.zhjd.common.utils.ResultUtils;
import com.qzsoft.zhjd.materiel.modules.materieldata.dto.MaterielDataListDto;
import com.qzsoft.zhjd.materiel.modules.materielsupplierdetailed.dto.MaterielSupplierDetailedDto;
import com.qzsoft.zhjd.materiel.modules.materielsupplierdetailed.service.MaterielSupplierDetailedService;

/**
 * @ClassName MaterielSupplierDetailedController
 * @Description 供应商供货明细分析控制器
 * @author linhuawei
 * @since 2022-04-01
 */
@RestController
@RequestMapping("/api/materielSupplierDetailed")
public class MaterielSupplierDetailedController {

    @Autowired
    private MaterielSupplierDetailedService materielSupplierDetailedService;

    /**
     * @Title page
     * @Description 获取供应商供货明细分页列表
     * @param params 查询条件
     * @return 分页列表
     */
    @RequiresPermissions("materiel:supplierdetailed:index")
    @GetMapping("/page")
    public Result<IPage<MaterielSupplierDetailedDto>> page(@RequestParam Map<String, Object> params) {
        IPage<MaterielSupplierDetailedDto> page = materielSupplierDetailedService.page(params);
        return ResultUtils.ok(page);
    }

    /**
     * @Title pageForSupplier
     * @Description 供应商磅单分页列表
     * @param params 查询条件
     * @return 供应商磅单分页列表
     */
    @RequiresPermissions("materiel:supplierdetailed:index")
    @GetMapping("/pageForSupplier")
    public Result<IPage<MaterielDataListDto>> pageForSupplier(@RequestParam Map<String, Object> params) {
        IPage<MaterielDataListDto> page = materielSupplierDetailedService.pageForSupplier(params);
        return ResultUtils.ok(page);
    }

    /**
     * @Title export
     * @Description 数据导出
     * @param params   查询条件
     * @param response
     */
    @RequiresPermissions("materiel:supplierdetailed:export")
    @GetMapping("/export")
    public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) {
        materielSupplierDetailedService.export(params, response);
    }

}
